const mongoose = require('mongoose')
const Scheme = mongoose.Schema
mongoose.connect('mongodb://localhost/code_order')

const moment = require('moment')

const adminSchema = new Scheme({
  userName: {  //用户名
    type: String,
    required: true
  },
  password: {  //密码
    type: String,
    required: true
  },
  avatarUrl: {  //头像
    type: String,
  },
  mobile: {  //手机
    type: Number
  },
  // grade: {  //等级   0普通管理员   1超级管理员
  //   type: Number,
  //   default: 0
  // },
  email: {  //邮箱
    type: String
  },
  sex: {  //性别  0女  1男
    type: Number,
    default: 1
  },
  createTime: {  //创建时间
    type: String,
    default: moment().format("YYYY-MM-DD HH:mm:ss")
  }
})

const Admin = mongoose.model('admin', adminSchema)
module.exports = Admin
